import com.dmotiko.sathya.*

class PrensaLoader {

	public static function run(src, target){
		
		var xml:XML = new XML();
		xml.ignoreWhite = true;
		xml.load(src);
		
		var aData:Array = new Array();
		
		xml.onLoad = function(){
			var xmlChild:XMLNode = this.firstChild;
			for(var i:Number=0; i < xmlChild.childNodes.length; i++){
				var aCollection:Array = new Array();
				var xmlCollection:XMLNode = xmlChild.childNodes[i];
				for(var i2:Number=0; i2 < xmlCollection.childNodes.length; i2++){
					var oItem:Object = new Object();
					oItem.icon = xmlCollection.childNodes[i2].attributes.icon;
					oItem.big = xmlCollection.childNodes[i2].attributes.big;
					oItem.title = xmlCollection.childNodes[i2].attributes.title;
					oItem.description = xmlCollection.childNodes[i2].attributes.description;
					if(!oItem.description) oItem.description = "";
					aCollection.push( oItem );
				}
				aData.push( aCollection );
			}
			target.pressData = aData;
		}
		
	}

}